package com.ruoyi.zhgd.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.ruoyi.zhgd.domain.vo.NAsphaltOutputPieVo;
import com.ruoyi.zhgd.domain.vo.NAsphaltOutputStatisticsVo;
import com.ruoyi.zhgd.mapper.NAsphaltOutputStatisticsMapper;
import com.ruoyi.zhgd.service.NAsphaltOutputStatisticsService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 沥青产量统计汇总业务接口实现
 *
 * @author tll
 * @date 2023-10-12
 */
@RequiredArgsConstructor
@Service
@DS("sjcj")
public class NAsphaltOutputStatisticsServiceImpl implements NAsphaltOutputStatisticsService {

    private final NAsphaltOutputStatisticsMapper baseMapper;


    /**
     * 历年产量数据
     * @param params
     * @return
     */
    @Override
    public List<NAsphaltOutputStatisticsVo> listForYear(Map<String, Object> params) {
        return baseMapper.listForYear(params);
    }

    /**
     * 月产量数据
     *
     * @param params
     * @return
     */
    @Override
    public List<NAsphaltOutputStatisticsVo> listForMonth(Map<String, Object> params) {
        return baseMapper.listForMonth(params);
    }

    /**
     * 日产量数据
     *
     * @param params
     * @return
     */
    @Override
    public List<NAsphaltOutputStatisticsVo> listForDay(Map<String, Object> params) {
        return baseMapper.listForDay(params);
    }

    /**
     * 项目产量数据
     * @param params
     * @return
     */
    @Override
    public NAsphaltOutputPieVo listForProject(Map<String, Object> params) {
        List<NAsphaltOutputStatisticsVo> list = baseMapper.listForProject(params);
        Double total = baseMapper.getTotal(params);
        NAsphaltOutputPieVo data = new NAsphaltOutputPieVo();
        data.setList(list);
        data.setTotal(total);
        return data;
    }

    /**
     * 配方产量数据
     *
     * @param params
     * @return
     */
    @Override
    public NAsphaltOutputPieVo listForMatch(Map<String, Object> params) {
        List<NAsphaltOutputStatisticsVo> list = baseMapper.listForMatch(params);
        Double total = baseMapper.getTotal(params);
        NAsphaltOutputPieVo data = new NAsphaltOutputPieVo();
        data.setList(list);
        data.setTotal(total);
        return data;
    }
}
